//
//  AboutBurntViewController.m
//  LINNER
//
//  Created by wei wang on 2017/5/2.
//  Copyright © 2017年 weiwang. All rights reserved.
//

#import "AboutBurntViewController.h"

@interface AboutBurntViewController ()
/** webView **/
@property(nonatomic,strong) UIWebView *webView;
@end

@implementation AboutBurntViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    NSString *saveLan = [[[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"] firstObject];;
    saveLan = [[[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"] firstObject];
    if ([saveLan isEqualToString:@"zh-Hans"]||[saveLan isEqualToString:@"zh-Hans-CN"]) {
        
        [self setNavigationBarTitle:MyNSLocalizedString(@"煲机说明")];

        
    }else{
        
        [self setNavigationBarTitle:@"Burn-in Instruction"];
        
    }
    

    
    [self setLeftButtonImage:[UIImage imageNamed:@"tittle_back_nor"]];
    [self.navigationController.navigationBar makeTransparent_nornav];
    
    self.webView = [[UIWebView alloc] init];
    self.webView.frame = CGRectMake(0, 64, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height-64);
    [self.view addSubview:self.webView];
    
    NSURL *baseURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]];
    
    NSUserDefaults* defaultL = [NSUserDefaults standardUserDefaults];
    NSArray* languages = [defaultL objectForKey:@"AppleLanguages"];
    NSString* preferredLang = [languages objectAtIndex:0];
    NSLog(@"Preferred Language:%@", preferredLang);
    if ([preferredLang isEqualToString:@"zh-Hans-CN"]) {
        
        NSString *path = [[NSBundle mainBundle] pathForResource:@"about" ofType:@"html"];
        NSString *html = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
        [_webView loadHTMLString:html baseURL:baseURL];
        
    }else{
        
        NSString *path = [[NSBundle mainBundle] pathForResource:@"about_en" ofType:@"html"];
        NSString *html = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
        [_webView loadHTMLString:html baseURL:baseURL];
        
    }

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
